package com.sino.operation.util;

import com.sino.operation.entity.BizTranslist;
import com.sino.operation.entity.SysAbMessage;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * 持久化工具
 *
 * @author Administrator
 * date 2021/10/16 0016 14:06
 */
@Slf4j
@Data
public class PersistenceUtil {

    //参数对象
    private List<Object> paramObject=new ArrayList<Object>();

    public void addEntity(Object entity){
        paramObject.add(entity);
    }

    public SysAbMessage getSysAbMessage(){
        SysAbMessage poObj = null;
        Iterator<Object> iter = this.iterator();
        while(iter.hasNext()){
            Object obj = iter.next();
            if(obj instanceof SysAbMessage){
                poObj = (SysAbMessage)obj;
                break;
            }
        }
        return poObj;
    }

    public Iterator<Object> iterator(){
        return paramObject.iterator();
    }
    public BizTranslist getBizTranslist(){
        BizTranslist poObj = null;
        Iterator<Object> iter = this.iterator();
        while(iter.hasNext()){
            Object obj = iter.next();
            if(obj instanceof BizTranslist){
                poObj = (BizTranslist)obj;
                break;
            }
        }
        return poObj;
    }
}
